package csel.model.skills;

import csel.model.entity.Entity;
import csel.model.entity.Character;

public class PickPocket extends NonRangedActiveSkill
{
	private static final long serialVersionUID = 5L;

	public PickPocket(Character owner)
	{
		super(owner);
		setName("pick-pocket");
		setDescription("self descriptive.");
	}
	
	@Override
	public void use(Entity e)
	{
		double chanceOfSuccess = 1.0 - ((1.0)/(Math.pow(2.0, getPointsAllocated())));
		double roll = Math.random();
		if(roll <= chanceOfSuccess)
		{
			getOwner().addToInventoryUseable(e.stealFrom());
		}
		else
		{
			e.pissTaitOff(getOwner());
		}
	}
}
